package com.cskaoyan.controller.admin;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.user.Feedback;
import com.cskaoyan.service.FeedBackService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author dww
 */

@RestController

@RequestMapping("admin/feedback")
public class FeedbackController {
    @Autowired
    private FeedBackService feedBackService;

    @RequestMapping("list")
    public BaseRespVo getList(Integer page, Integer limit, String sort, String order, String username, Integer id) {
        List<Feedback> list = feedBackService.getFeedBackList(page, limit, sort, order, username, id);
        long total = PageInfo.of(list).getTotal();
        Map<String, Object> map = new HashMap<>();
        map.put("total", total);
        map.put("items", list);
        BaseRespVo<Object> respVo = new BaseRespVo<>(0, map, "成功");
        return respVo;
    }
}
